Skip to content

fix(amu): block print starts that PRINT_START would refuse as unloaded - #363

Merged
gmmcosta15 merged 3 commits into
devfrom
fix/print-start-unloaded-check
Oct 23, 2026
Merged

gmmcosta15 merged 3 commits into
devfrom
fix/print-start-unloaded-check

Conversation

@gmmcosta15

@gmmcosta15 gmmcosta15 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

  • Feature
  • Bug Fix
  • Code Refactor
  • Documentation

Starting a print on an unloaded machine left Happy-Hare running a job that had already been cancelled. RF50-Klipper's PRINT_START raised "Machine is unloaded", virtual_sdcard ran CANCEL_PRINT, and Happy-Hare's deferred auto-start re-opened the job (#358 closes that job afterwards). This PR runs the macro's unloaded check in BlocksScreen before the print is sent, so the start never happens and the screen says why.

Changes

  • amu manager: print_start_refusal() returns why PRINT_START would refuse, using the macro's exact test (sensors.toolhead == False or sensors.mmu_pre_gate == False); a missing or disabled (None) sensor passes, as in the macro
  • print tab: start_print runs that check before JobStatusWidget.on_print_start; a refusal is logged and shown through a new notify signal, wired to the notification page
  • print tab: takes an optional amu_manager; without one (no AMU) prints start as before
  • main window: the cancel page's reprint goes through start_print too, so it gets the same check as a fresh print

Motivation

  • A refused PRINT_START is not a clean refusal: the on_error CANCEL_PRINT races Happy-Hare's deferred MMU_PRINT_START AUTOMATIC=1, which re-opens the job with the gear synced, FlowGuard armed and the tensioner in print mode
  • The check copies config/print_start.cfg instead of reading HH's gate map, so BlocksScreen refuses exactly the starts the macro would refuse

Tests

  • New: TestPrintStartRefusal (no state, loaded/missing/disabled sensors, toolhead empty, gate empty, klippy disconnect drops the refusal), tests/widgets/test_print_start_guard_unit.py (start without AMU or refusal, refusal blocks and notifies)

Future work

  • Report the deferred auto-start race upstream to Happy-Hare
  • Keep print_start_refusal in step with print_start.cfg if the macro's condition changes

@gmmcosta15 gmmcosta15 self-assigned this Oct 22, 2026
@gmmcosta15
gmmcosta15 requested a review from a team October 22, 2026 09:30
@gmmcosta15 gmmcosta15 added the bug Something is broken, or a fix for it label Oct 23, 2026
@gmmcosta15
gmmcosta15 merged commit 2c72316 into dev Oct 23, 2026
9 checks passed
@gmmcosta15
gmmcosta15 deleted the fix/print-start-unloaded-check branch October 23, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is broken, or a fix for it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants